/**
 * @author chenfuxin
 * @date 2019-11-22 16:25
 */

import request from '../config/request'
import host from '../config/host'

/**
 * 加载数据分析图表
 * @param callback
 */
const getUserBoardList = function (callback) {
    request.getData(
        host.pcHostUrl + '/wx/board/getUserBoardList',
        callback
    );
};


/**
 * 分享图表数据
 * @param callback
 */
const getBoardByShareCode = function (shareCode, callback, error) {
    request.getData(
        host.pcHostUrl + '/wx/board/getBoardByShareCode?shareCode=' + shareCode,
        callback,
        error
    );
};


/**
 * 加载数据图表数据
 * @param data
 * @param callback
 */
const widgetAnalysis = function (data, callback,error) {
    request.postData(
        host.pcHostUrl + '/wx/board/widgetAnalysis',
        data,
        callback,
        error
    );
};

/**
查看数据详情
*/
const getDatasDetail = function(data, callback){
    request.postData(
        host.pcHostUrl + "/wx/deviceDetailData/dataList",
        data,
        callback
    );
}

const getChartConfig = function(data, callback){
    request.postData(
        host.pcHostUrl + "/wx/board/v2/getUserBoard",
        data,
        callback
    );
}

const getChartData = function(data, callback){
    request.postData(
        host.pcHostUrl + "/wx/board/v2/getBoardData",
        data,
        callback
    );
}

export default {
  getUserBoardList,
  getBoardByShareCode,
  widgetAnalysis,
  getDatasDetail,
  getChartConfig,
  getChartData,
}
